import store from '@/store'
import { CancelSubmit } from '@/api/Approval/index'

export function onApprove(data) {
  store.dispatch('approve/getApprove', data)
}

export function onApproveInsert(data) {
  store.dispatch('approve/getApproveInsert', data)
}


export function approveClose(boolean) {
  store.dispatch('approve/approveClose', boolean)
}
export function approveInsertClose(boolean) {
  store.dispatch('approve/approveInsertClose', boolean)
}
export function approveInsertReset() {
  store.dispatch('approve/approveInsertReset')
}

export async function onApproveCancel(data) {
  await CancelSubmit(data).then(result => {
    if (result.success) {
      this.$message.success(result.message)

    } else {
      this.$message.error(result.message)
    }
  })
}